<p class="TextInTable"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>If the variables are separated by commas (for example, DIM sPar1, sPar2, sPar3 AS STRING), only Variant variables can be defined. Use a separate definition line for each variable.</p>
<p class="TextInTable"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/>Dim declares local variables within subroutines. Global variables are declared with the PUBLIC or the PRIVATE statement.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">VarName:</span> Any variable or array name.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Start, End:</span> Numerical values or constants ranging from -32768 to 32767 that define the number of elements (NumberElements=(end-start)+1) and the index range.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>Start and End can be numerical expressions if ReDim is applied at the procedure level.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">VarType:</span> Key word that declares the data type of a variable.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="22" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Object:</span> Object variable (Note: this variable can only subsequently be defined with Set!)</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="23" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">Single:</span> Single-precision floating-point variable (3,402823 x 10E38 - 1,401298 x 10E-45).</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="24" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">String:</span> String variable consisting of a maximum of 64,000 ASCII characters.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="25" xmlns:help="http://openoffice.org/2000/help"/><span class="T1">[Variant]:</span> Variant variable type (contains all types, specified by definition). If a key word is not specified, variables are automatically defined as Variant Type, unless a statement from DefBool to DefVar is used.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="26" xmlns:help="http://openoffice.org/2000/help"/>In <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>Basic, you do not need to declare variables explicitly. However, you need to declare an array before you can use them. You can declare a variable with the Dim statement, using commas to separate multiple declarations. To declare a variable type, enter a type-declaration character following the name or use a corresponding key word.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="27" xmlns:help="http://openoffice.org/2000/help"/><help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic supports single or multi-dimensional arrays that are defined by a specified variable type. Arrays are suitable if the program contains lists or tables that you want to edit. The advantage of arrays is that it is possible to address individual elements according to indexes, which can be formulated as numeric expressions or variables.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="28" xmlns:help="http://openoffice.org/2000/help"/>Arrays are declared with the Dim statement. There are two methods to define the index range:</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="29" xmlns:help="http://openoffice.org/2000/help"/>DIM text(20) as String REM 21 elements numbered from 0 to 20</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="30" xmlns:help="http://openoffice.org/2000/help"/>DIM text(5 to 25) as String REM 21 elements numbered from 5 to 25</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="31" xmlns:help="http://openoffice.org/2000/help"/>DIM text(-15 to 5) as String REM 21 elements (including 0)</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="32" xmlns:help="http://openoffice.org/2000/help"/>REM numbered from -15 to 5</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="33" xmlns:help="http://openoffice.org/2000/help"/>Two-dimensional data field</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="34" xmlns:help="http://openoffice.org/2000/help"/>DIM text(20,2) as String REM 63 elements; form 0 to 20 level 1, from 0 to 20 level 2 and from 0 to 20 level 3.</p>
<p class="Paragraph"><help:paragraphinfo state="U" number="35" xmlns:help="http://openoffice.org/2000/help"/>You can declare an array types as dynamic if a ReDim statement defines the number of dimensions in the subroutine or the function that contains the array. Generally, you can only define an array dimension once, and you cannot modify it. Within a subroutine, you can declare an array with ReDim. You can only define dimensions with numeric expressions. This ensures that the fields are only as large as necessary.</p>